package com.haishuibutian.kafkaproducer.web;

import com.haishuibutian.kafkaproducer.config.KafkaClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloProducer {

    private final KafkaClient kafkaClient;

    public HelloProducer(KafkaClient kafkaClient) {
        this.kafkaClient = kafkaClient;
    }

    @GetMapping("/kafka/normal/{message}")
    public void hello(@PathVariable("message") String normalMessage){
        kafkaClient.send("testTopic",normalMessage);
    }
}
